﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Default/Site.Master" AutoEventWireup="true" %>
<%@ Import Namespace="WebDotNet.Extensions" %>
<%@ Import Namespace="WebDotNet.Samples.WdnMicroBlog.App.Entites" %>
<script runat="server">
	public Entry ViewData
	{
		get
		{
			return (Entry)HttpContext.Current.Items[WebFormsExtensions.ViewDataKey];
		}
	}
</script>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolderTitle" runat="server">
<%: this.ViewData.Title %>
</asp:Content>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolderBody" runat="server">
    <h1><%: this.ViewData.Title %></h1>
    <p><%: this.ViewData.CreatedOn.ToString() %></p>
    <div><%: this.ViewData.Content %></div>
    <% if (this.ViewData.Comments.Any()) { %>
        <h2>Comments so far</h2>
        <ol>
            <% foreach (Comment comment in this.ViewData.Comments) { %>
                <li>
                    <div><%: comment.Content %></div>
                    <p>
                        <% if (!string.IsNullOrEmpty(comment.Url)) { %>
                            <a href="http://<%: comment.Url %>"><%: comment.Name %></a>
                        <% } else { %>
                            <%: comment.Name %>
                        <% } %>
                    </p>
                </li>
            <% } %>
        </ol>
    <% } %>
    <form action="" method="post">
        <div>
            <label for="name">Name</label>
            <input type="text" id="name" name="name">
            <label for="email">Email</label>
            <input type="text" id="email" name="email">
            <label for="url">Site</label>
            <input type="text" id="url" name="url">
            <label for="comment">Comment</label>
            <textarea name="content" id="content"></textarea>
        </div>
        <div>
            <input type="submit">
        </div>
    </form>
</asp:Content>
